<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/StaffTemplate.xhtml">

    <ui:define name="nav_menu">
        <p:menubar model="#{staffUnlockAccountManagedBean.staffMenuModel}"/>
    </ui:define>

    <ui:define name="content">
        <h:form>
            <f:view beforePhase="#{staffUnlockAccountManagedBean.initView}">
                <h:selectOneMenu id="searchBy" required="true" value="#{staffUnlockAccountManagedBean.accountSelected}" >
                    <f:selectItems value="#{staffUnlockAccountManagedBean.accountSelectedItems}" />
                </h:selectOneMenu>

                <p:commandButton id="btnSelectAccount" actionListener="#{staffUnlockAccountManagedBean.selectAccounts}" value="#{bundle['staff.submit.button']}" update="accountPanel" ajax="true"/>
                <p:panel id="accountPanel">
                    <p:dataTable var="staffAccountState" value="#{staffUnlockAccountManagedBean.accountList}" paginator="true" rows="10" selectionMode="single">  
                        <f:facet name="header" >  
                            <h:outputText value="#{bundle['staff.listOfAccounts.button']}" />
                        </f:facet>  
                        <p:column sortBy="#{staffAccountState.username}" filterBy="#{staffAccountState.username}">  
                            <f:facet name="header">  
                                <h:outputText value="#{bundle['staff.username.label']}" />  
                            </f:facet>  
                            <h:outputText value="#{staffAccountState.username}" />  
                        </p:column>  
                        <p:column> 
                            <p:cellEditor>
                                <f:facet name="header">  
                                    <h:outputText value="#{bundle['staff.accountInactivationStatus.label']}" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <h:selectBooleanCheckbox value="#{staffAccountState.activationStatus}" />
                                </f:facet>
                                <f:facet name="output">  
                                    <h:outputText value="#{staffAccountState.activationStatus}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>  
                        <p:column headerText="Edit">  
                            <p:rowEditor />  
                        </p:column>  
                    </p:dataTable>
                </p:panel>
                <p:commandButton id="btnConfirm" actionListener="#{staffAccountState.confirmChanges}" value="#{bundle['staff.savechanges.button']}" update="accountPanel" ajax="true"/>
            </f:view>
        </h:form>
    </ui:define>

</ui:composition>
